import getApiData from "@/services/cpasRequest";
import notify from 'devextreme/ui/notify';

export async function updateCutOffDate(params: {
  dbname: string,
  Data_ID: string,
  byMonth: string,
  editUser: string
}) {
  const res = await getApiData("account.cutOffDate.update", params);
  if (res.ok) {
    return Promise.resolve({
      data: res.data,
      success: true,
    });
  }
  return Promise.resolve({
    data: -1,
    success: false,
  });
}

export async function initCutOffDate(params: {
  dbname: string,
  Data_ID: string,
  isForceInit: boolean
}) {
  const res = await getApiData("account.subjectSDB.init", params);
  if (res.ok) {
    return Promise.resolve({
      data: res.data,
      success: true,
    });
  }
  return Promise.resolve({
    data: -1,
    success: false,
  });
}

export async function getMonthList(params: {
  dbname: string,
  Data_ID: string,
}) {
  const res = await getApiData("account.accountInfo.getMonthList", params);
  if (res.ok) {
    return res.data;
  }
  return {};
}